<!doctype html>
<html>

<head>
    <title>Socket.IO chat</title>
    <style>
    </style>
</head>

<body>
    <ul id="messages"></ul>
    <button id="lis" click="init">啊</button>

    <form action="">
        <input id="m" autocomplete="off" />
        <button>Send</button>
    </form>
</body>
<script src="/socket.io/socket.io.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script>
    $(function () {
        var socket = io();
        $('form').submit(function () {
            socket.emit('chat message', $('#m').val());
            $('#m').val('');
            return false;
        });
        socket.emit('user', 'a进入房间');
        socket.on('chat message', function (msg) {
            $('#messages').append($('<li>').text(msg));
        });
    });
</script>

</html>